package Practice;

import java.util.Arrays;
import java.util.Scanner;

public class Bookshelf {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(),b = sc.nextInt();
        int[] h = new int[n];
        for (int i = 0; i < h.length; i++) {
            h[i] = sc.nextInt();
        }
        Arrays.sort(h);
        int s = 0;
        int num = 0;
        for (int i = n-1; i > 0; i--) {
            s += h[i];
            num++;
            if (s >= b){
                System.out.println(num);
                return;
            }
        }
    }
}
